﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace DivisonsCodeTools.Business
{
    public class Log
    {
        public static void WriteLog(string msg)
        {
            string file = Environment.CurrentDirectory + '\\' + "DivisonsLog.txt";
            StreamWriter fs = new StreamWriter(file, true);
            fs.WriteLine(msg + " \n 打印时间: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            fs.WriteLine();
            fs.Close();
        }

        public static void WriteLog(string msg, Exception ex)
        {
            string file = Environment.CurrentDirectory + '\\' + "DivisonsLog.txt";
            StreamWriter fs = new StreamWriter(file, true);
            fs.WriteLine(msg + "\n" + ex.Message + "\n" + " \n 打印时间: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            fs.WriteLine();
            fs.Close();
        }
    }
}
